var jwt = require('jsonwebtoken');

const privateKey = '1111use.ky222'





module.exports={
    parseToken :function parseToken(req){
        var __j = req.state.__j;
        if(!__j){
            return{error:'jwt invalid'}
        }
        try {
            var decode = jwt.verify(__j,privateKey)
        } catch(err) {
            return{error:'jwt invalid'}
        }
        return decode;
    },
    setJwt:function setJwt(data){
        return jwt.sign(data,privateKey)
    }
}
